package com.tuishan.myapplication.ViewModels;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;
import androidx.paging.DataSource;
import androidx.paging.LivePagedListBuilder;
import androidx.paging.PagedList;

import com.tuishan.myapplication.Model.UserLogModel;

/**
 * <pre>
 *     time   : 2021/04/17
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class UserLogViewModel extends ViewModel {
    private LiveData<PagedList<UserLogModel>> convertList;
    private DataSource<Integer, UserLogModel> concertDataSource;

    public UserLogViewModel() {

    }

    public void init(int arg1) {
        UserLogFactory concertFactory = new UserLogFactory(arg1);
        concertDataSource = concertFactory.create();
        convertList = new LivePagedListBuilder<>(concertFactory, 10).build();

    }

    public void invalidateDataSource() {
        concertDataSource.invalidate();
    }

    public LiveData<PagedList<UserLogModel>> getConvertList() {
        return convertList;
    }
}
